function [Syn_OK_Indication, Syn_Index_PSSS] = Function_PSSS_Detection(Signal, PSSS_Time_Domain)

    PSSS_Length = length(PSSS_Time_Domain);

    Rpsss = Function_Cross_Correlator(Signal, PSSS_Time_Domain);
    Rpsss = abs(Rpsss);
    
    Rpsss_Length = length(Rpsss);
    
    PSSS_Corr_Max_Value_1 = 0;
    PSSS_Corr_Max_Index_1 = 0;
    
    for n = 1:Rpsss_Length
        if(Rpsss(n)>PSSS_Corr_Max_Value_1)
            PSSS_Corr_Max_Value_1 = Rpsss(n);
            PSSS_Corr_Max_Index_1 = n;
        end
    end
    
    Temp_1 = 0;
    Temp_2 = 0;
    if(PSSS_Corr_Max_Index_1 < (Rpsss_Length - PSSS_Length))
        Temp_1 = Rpsss(PSSS_Corr_Max_Index_1 + PSSS_Length);
    end
    if(PSSS_Corr_Max_Index_1 > PSSS_Length)
        Temp_2 = Rpsss(PSSS_Corr_Max_Index_1 - PSSS_Length);
    end
    
	if(Temp_1>Temp_2)
        PSSS_Corr_Max_Value_2 = Temp_1;
    	PSSS_Corr_Max_Index_2 = PSSS_Corr_Max_Index_1 + PSSS_Length;
    else
     	PSSS_Corr_Max_Value_2 = Temp_2;
    	PSSS_Corr_Max_Index_2 = PSSS_Corr_Max_Index_1 - PSSS_Length;
    end

	Temp_1 = PSSS_Corr_Max_Value_1 / ((PSSS_Corr_Max_Value_1+PSSS_Corr_Max_Value_2)/2);
	Temp_2 = PSSS_Corr_Max_Value_2 / ((PSSS_Corr_Max_Value_1+PSSS_Corr_Max_Value_2)/2);
	if(abs(Temp_1 - Temp_2)<0.3)
    	Syn_OK_Indication = 1;

        Temp_1 = 0;
      	Temp_2 = 0;
    	for n = 1:20
        	if(Rpsss(PSSS_Corr_Max_Index_2 - 10 + n)>Temp_1)
            	Temp_1 = Rpsss(PSSS_Corr_Max_Index_2 - 10 + n);
            	Temp_2 = PSSS_Corr_Max_Index_2 - 10 + n;
            end
        end
        PSSS_Corr_Max_Index_2 = Temp_2;
        Syn_Index_PSSS = floor((PSSS_Corr_Max_Index_1 + PSSS_Corr_Max_Index_2 - PSSS_Length) / 2);
    else
        Syn_OK_Indication = 0;
        Syn_Index_PSSS = -1;
	end
end

    